<?php

namespace App\Http\Controllers\Api\Hotel;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Facades\Services\ComplaintService;

class ComplaintController extends Controller
{
    public function createComplaint(Request $request){

    	$rules = [
    		'complaint_name' => 'required'
    	];

    	$this->validate($request,$rules);

    	ComplaintService::createComplaint($request->all());

    	return formatJsonResponse();
    }

    public function getComplaints(Request $request){

    	return formatJsonResponse(ComplaintService::getComplaints($request->all()));

    }

    public function getComplaint(Request $request){
    	$rules = [
    		'id' => 'required'
    	];

    	$this->validate($request,$rules);

    	return formatJsonResponse(ComplaintService::getComplaint($request->all()));
    }

    public function updateComplaint(Request $request){
    	$rules = [
    		'id' => 'required',
    		'complaint_name' => 'required'
    	];

    	$this->validate($request,$rules);

    	ComplaintService::updateComplaint($request->all());

    	return formatJsonResponse();
    }

    public function deleteComplaint(Request $request){
    	$rules = [
    		'id' => 'required'
    	];

    	$this->validate($request,$rules);

    	ComplaintService::deleteComplaint($request->all());

    	return formatJsonResponse();
    }
}
